package com.wongleoi.weather_demo

import android.os.Bundle
import android.view.View
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.wongleoi.weather_demo.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {
    private val mViewModel by viewModels<WeatherViewModel>()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val viewBinding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(viewBinding.root)
        mViewModel.loading.observe(this) {
            viewBinding.progressBar.visibility = if(it) View.VISIBLE else View.GONE
        }
    }
}